package com.example.vo.Controller

import android.view.View

abstract class RejectClick : View.OnClickListener {
    companion object {
        const val MIN_CLICK_DELAY_TIME = 800 //两个点击最小间隔
    }

    var lastClickTime: Long = 0
    override fun onClick(v: View?) {
        var curTime = System.currentTimeMillis()
        if (curTime - lastClickTime > MIN_CLICK_DELAY_TIME) { //只有大于才会走逻辑
            lastClickTime = curTime
        }
    }
}

//class RejectClick {
//    private val TIME = 1000
//    private var lastClickTime: Long = 0
//
//    fun isFastDoubleClick(): Boolean {
//        val currentTime = System.currentTimeMillis()
//        val timeInterval = currentTime - lastClickTime
//        if (0 < timeInterval && timeInterval < TIME) {
//            return true
//        }
//        lastClickTime = currentTime
//        return false
//    }
//}